

package com.hazelcast.internal.serialization.impl.defaultserializers;

import com.hazelcast.internal.serialization.impl.SerializationConstants;
import com.hazelcast.nio.ObjectDataInput;

import java.io.IOException;
import java.util.concurrent.DelayQueue;
import java.util.concurrent.Delayed;

/**
 * The {@link DelayQueue} serializer
 */
public class DelayQueueStreamSerializer<E extends Delayed> extends AbstractCollectionStreamSerializer<DelayQueue<E>> {

    @Override
    public int getTypeId() {
        return SerializationConstants.JAVA_DEFAULT_TYPE_DELAY_QUEUE;
    }

    @Override
    public DelayQueue<E> read(ObjectDataInput in) throws IOException {
        int size = in.readInt();

        DelayQueue<E> collection = new DelayQueue<>();

        return deserializeEntries(in, size, collection);
    }
}
